package com.newasia.server.common.template.dataItem;


import com.newasia.server.common.template.dataItem.basics.*;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author LiChong
 * @description 协议格式
 * @date 2020/4/20
 */

@Data
public class ProtocolFormat {

    private Name name;

    private Activ activ;

    private DataShow dataShow;

    private SetupShow setupShow;

    private StartStop startStop;

    private StartStopSetup startStopSetup;

    private DataCount data;

    private SetupCount setup;

    private Cmd cmd;

    private WiFi wiFi;

    private List<DataType> dataList;

    private List<DataType> setupList;

    public void setDataList(List<DataType> dataList,Integer size) {
        this.dataList = new ArrayList<DataType>();
        for (int i=0;i<size;i++){
            DataType dataType = dataList.get(i);
            dataType.setFormula();
            this.dataList.add(dataType);
        }
    }

    public void setSetupList(List<DataType> setupList,Integer size) {
        this.setupList = new ArrayList<DataType>();
        for (int i=0;i<size;i++){
            DataType dataType = setupList.get(i);
            dataType.setFormula();
            this.setupList.add(dataType);
        }
    }
}
